package org.linlinjava.litemall.db.service;

import java.time.LocalDateTime;
import java.util.List;

import javax.annotation.Resource;

import com.github.yulichang.base.MPJBaseServiceImpl;
import org.linlinjava.litemall.db.dao.LitemallRefundGoodsMapper;
import org.linlinjava.litemall.db.domain.LitemallRefundGoods;
import org.linlinjava.litemall.db.domain.LitemallRefundGoodsExample;
import org.springframework.stereotype.Service;

@Service
public class LitemallRefundGoodsService extends MPJBaseServiceImpl<LitemallRefundGoodsMapper,LitemallRefundGoods> {
	
    @Resource
    private LitemallRefundGoodsMapper refundGoodsMapper;
    
    public LitemallRefundGoods findById(Integer id) {
    	return refundGoodsMapper.selectByPrimaryKey(id);
    }

    public void add(LitemallRefundGoods refundGoods) {
    	refundGoods.setAddTime(LocalDateTime.now());
    	refundGoodsMapper.insertSelective(refundGoods);
    }
    
    public void update(LitemallRefundGoods refundGoods) {
    	refundGoodsMapper.updateByPrimaryKeySelective(refundGoods);
    }
    
    public List<LitemallRefundGoods> findByRefundId(Integer refundId){
    	 LitemallRefundGoodsExample example = new LitemallRefundGoodsExample();
         example.or().andRefundIdEqualTo(refundId).andDeletedEqualTo(false);
         
         return refundGoodsMapper.selectByExample(example);
    }

}
